<template>
<div class="">
    <div class="pr10">
        <div class="analyItem">
            <p class="analyItemTit tx-center">状态</p>
            <div class="analyItemCon">
                <span class="circlemark circlemark-lightRed">差</span>
            </div>
        </div>
    </div>
    <div class="thinScroll pr10" v-scrollHeight="84">
        <router-link tag="div" :to="routerPath('financePaymentcollection')" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">回款</p>
            <div class="analyItemCon">
                <p class="col-md-4">
                    <span class="pr8 cLightGray">回款率</span>
                    <span>{{RepaymentRatioMap.normalRepaymentRatio.toFixed(2)}}%</span>
                </p>
                <p class="col-md-4">
                    <span class="pr8 cLightGray">标准</span>
                    <span>75%</span>
                </p>
                <p class="col-md-4">
                    <span class="pr8 cLightGray">差额</span>
                    <span  >{{(75 - RepaymentRatioMap.normalRepaymentRatio).toFixed(2)}}%</span>
                </p>
                <span v-if="RepaymentRatioMap.normalRepaymentRatio >= 80" class="circlemark circlemark-green">优</span>
                <span v-else-if="RepaymentRatioMap.normalRepaymentRatio < 80 &&  RepaymentRatioMap.normalRepaymentRatio >= 75" class="circlemark circlemark-lightGreen">良</span>
                <span v-else-if="RepaymentRatioMap.normalRepaymentRatio < 75 &&  RepaymentRatioMap.normalRepaymentRatio >= 60 " class="circlemark circlemark-yellow">中</span>
                <span v-else class="circlemark circlemark-lightRed">差</span>
            </div>
        </router-link>
        <router-link tag="div" :to="routerPath('financeQualityassurancedeposit')" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">质保金</p>
            <div class="analyItemCon">
                <p class="col-md-4">
                    <span class="pr8 cLightGray">未收</span>
                    <span>{{((RepaymentRatioMap.warrantyAllReceivable - RepaymentRatioMap.warrantyAllReceived) / 10000).toFixed(2)}}W</span>
                </p>
                <p class="col-md-4">
                    <span class="pr8 cLightGray">本月应收</span>
                    <span>{{(RepaymentRatioMap.warrantyReceivable / 10000).toFixed(2)}}W</span>
                </p>
                <p class="col-md-4">
                    <span class="pr8 cLightGray">本月已收</span>
                    <span>{{((RepaymentRatioMap.warrantyReceived) / 10000).toFixed(2)}}W</span>
                </p>
            </div>
        </router-link>
        <div class="analyItem">
            <p class="analyItemTit tx-center">洽商</p>
            <div class="analyItemCon">
                <p class="col-md-4">
                    <span class="pr8 cLightGray">金额</span>
                    <span>0</span>
                </p>
                <p class="col-md-4">
                    <span class="pr8 cLightGray">利润</span>
                    <span>0</span>
                </p>
            </div>
        </div>
        <div class="analyItem">
            <p class="analyItemTit tx-center">罚款</p>
            <div class="analyItemCon">
                <p class="col-md-4">
                    <span class="pr8 cLightGray">金额</span>
                    <span>2000</span>
                </p>
            </div>
        </div>
    </div>
    <div class="pr10">
        <router-link tag="div" :to="routerPath('financeProcessing')" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">处理</p>
            <div class="analyItemCon">

            </div>
        </router-link>
    </div>
</div>
</template>
<script>
import { getRepaymentRatio } from '../Resources/Api'
import { mapGetters } from 'vuex'
export default {
    data () {
        return {
            RepaymentRatioMap: {}
        }
    },
    created () {
        this.getRepaymentRatio()
    },
    computed: {
        ...mapGetters(['userInfo', 'leftInfo'])
    },
    methods: {
        getRepaymentRatio () {
            getRepaymentRatio({
                regionID: this.leftInfo.u_diqu
            }).then(res => {
                if (res.data.StatusCode === 0) {
                    this.RepaymentRatioMap = res.data.Body.RepaymentRatioMap
                }
            }).catch(err => {
                console.log(err)
            })
        },
        // 路由跳转路径拼接
        routerPath (path) {
            return this.$route.matched[1].path + '/' + path
        },
        // 直接进行路由跳转路径
        routerPush (path) {
            this.$router.push(this.$route.matched[1].path + '/' + path)
        }
    },
    watch: {
        leftInfo () {
            this.getRepaymentRatio()
        }
    }
}
</script>
